﻿<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
	xmlns:xlink="http://www.w3.org/1999/xlink"
	exclude-result-prefixes="msxsl">

	<xsl:output method="xml" indent="yes" encoding="utf-8" />
<xsl:template match="/">
	
<xsl:apply-templates select="TypeDifference" />

</xsl:template>

<xsl:template match="TypeDifference">

<topic>
<xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute>
<xsl:attribute name="revisionNumber">1</xsl:attribute>

	<xsl:text disable-output-escaping="yes"><![CDATA[<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">]]></xsl:text>

		<section>
			<xsl:attribute name="address">Introduction</xsl:attribute>
			<title><xsl:value-of select="@Name" /></title>
			<content>
        <codeEntityReference>
          <xsl:attribute name="qualifyHint">true</xsl:attribute>
          <xsl:if test="@NamespaceName != ''">
            T:<xsl:value-of select="@NamespaceName" />.<xsl:value-of select="@Name" />
          </xsl:if>  
          <xsl:if test="@NamespaceName = ''">
            T:<xsl:value-of select="@Name" />
          </xsl:if>  
      </codeEntityReference>
			</content>
		</section>

<xsl:apply-templates select="TypeTaxonomy" />
<xsl:apply-templates select="InheritanceChanged" />

<!-- Removed -->  
<xsl:apply-templates select="ConstantsRemoved" />
<xsl:apply-templates select="FieldsRemoved" />
<xsl:apply-templates select="ConstructorsRemoved" />
<xsl:apply-templates select="FinalizersRemoved" />
<xsl:apply-templates select="EventsRemoved" />
<xsl:apply-templates select="PropertiesRemoved" />
<xsl:apply-templates select="IndexersRemoved" />
<xsl:apply-templates select="MethodsRemoved" />
<xsl:apply-templates select="ValuesRemoved" />

<!-- Obsolete -->  
<xsl:apply-templates select="ConstantsObsolete" />
<xsl:apply-templates select="FieldsObsolete" />
<xsl:apply-templates select="ConstructorsObsolete" />
<xsl:apply-templates select="EventsObsolete" />
<xsl:apply-templates select="PropertiesObsolete" />
<xsl:apply-templates select="IndexersObsolete" />
<xsl:apply-templates select="MethodsObsolete" />
  
<!-- Changed -->
<xsl:apply-templates select="ConstantsChanged" />
<xsl:apply-templates select="FieldsChanged" />
<xsl:apply-templates select="ConstructorsChanged" />
<xsl:apply-templates select="EventsChanged" />
<xsl:apply-templates select="PropertiesChanged" />
<xsl:apply-templates select="IndexersChanged" />
<xsl:apply-templates select="MethodsChanged" />
  
<!-- Added -->  
<xsl:apply-templates select="ConstantsAdded" />
<xsl:apply-templates select="FieldsAdded" />
<xsl:apply-templates select="ConstructorsAdded" />
<xsl:apply-templates select="FinalizersAdded" />
<xsl:apply-templates select="EventsAdded" />
<xsl:apply-templates select="PropertiesAdded" />
<xsl:apply-templates select="IndexersAdded" />
<xsl:apply-templates select="MethodsAdded" />
<xsl:apply-templates select="ValuesAdded" />
 
<!-- TODO:Finalizers -->

<!-- TODO:Delegates -->

		<relatedTopics>
			<codeEntityReference><xsl:attribute name="qualifyHint">true</xsl:attribute>T:<xsl:value-of select="@Name" /></codeEntityReference>
		</relatedTopics>

		<!-- navigation -->
		<section>
			<content>
				<para>
					<link>
						<xsl:attribute name="xlink:href"><xsl:value-of select="@SummaryID" />
						</xsl:attribute><xsl:value-of select="@SummaryName" />
					</link> | 
					<link>
						<xsl:attribute name="xlink:href"><xsl:value-of select="@AssemblyID" />
						</xsl:attribute><xsl:value-of select="@AssemblyName" />
					</link>
				</para>
			</content>
		</section>

		<!-- link back to summary -->
	<xsl:text disable-output-escaping="yes"><![CDATA[</developerConceptualDocument>]]></xsl:text>

</topic>

</xsl:template>

<xsl:template match="TypeInheritanceChange">

<xsl:if test="not(@To = '')">
	<row><entry><para>Base type changed from 
<codeEntityReference><xsl:attribute name="qualifyHint">true</xsl:attribute>T:<xsl:value-of select="@From" /></codeEntityReference>
 to <codeEntityReference><xsl:attribute name="qualifyHint">true</xsl:attribute>T:<xsl:value-of select="@To" /></codeEntityReference>
</para></entry></row>
</xsl:if>

<xsl:if test="@To = ''">
	<row><entry><para>No longer derived from 
<codeEntityReference><xsl:attribute name="qualifyHint">true</xsl:attribute>T:<xsl:value-of select="@From" /></codeEntityReference>
</para></entry></row>
</xsl:if>

</xsl:template>

<!-- Top level changes -->

<xsl:template match="TypeTaxonomy">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'General Changes'" />
    <xsl:with-param name="column1" select="'Change'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="InheritanceChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Inheritance Changes'" />
    <xsl:with-param name="column1" select="'Was'" />
    <xsl:with-param name="column2" select="'Is'" />
    <xsl:with-param name="column3" select="'Description'" />
  </xsl:call-template>

</xsl:template>

<!-- Removed -->  
<xsl:template match="ConstantsRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Constants'" />
    <xsl:with-param name="column1" select="'Constant'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FieldsRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Fields'" />
    <xsl:with-param name="column1" select="'Field'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ConstructorsRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Constructors'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FinalizersRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Finalizer'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>


  <xsl:template match="EventsRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Events'" />
    <xsl:with-param name="column1" select="'Event'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="PropertiesRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Properties'" />
    <xsl:with-param name="column1" select="'Property'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="IndexersRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Indexers'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="MethodsRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Methods'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ValuesRemoved">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Removed Enum Values'" />
    <xsl:with-param name="column1" select="'Value'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<!-- Obsolete -->  
<xsl:template match="ConstantsObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Constants'" />
    <xsl:with-param name="column1" select="'Constant'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FieldsObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Fields'" />
    <xsl:with-param name="column1" select="'Field'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ConstructorsObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Constructors'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="EventsObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Events'" />
    <xsl:with-param name="column1" select="'Event'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="PropertiesObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Properties'" />
    <xsl:with-param name="column1" select="'Property'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="IndexersObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Indexers'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="MethodsObsolete">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Obsolete Methods'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

  
<!-- Changed -->
<xsl:template match="ConstantsChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Constants'" />
    <xsl:with-param name="column1" select="'Constant'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FieldsChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Fields'" />
    <xsl:with-param name="column1" select="'Field'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ConstructorsChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Constructors'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="EventsChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Events'" />
    <xsl:with-param name="column1" select="'Event'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="PropertiesChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Properties'" />
    <xsl:with-param name="column1" select="'Property'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="IndexersChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Indexers'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="MethodsChanged">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Changed Methods'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

  
<!-- Added -->  
<xsl:template match="ConstantsAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Constants'" />
    <xsl:with-param name="column1" select="'Constant'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FieldsAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Fields'" />
    <xsl:with-param name="column1" select="'Field'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ConstructorsAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Constructors'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="FinalizersAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Finalizer'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

  <xsl:template match="EventsAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Events'" />
    <xsl:with-param name="column1" select="'Event'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="PropertiesAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Properties'" />
    <xsl:with-param name="column1" select="'Property'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="IndexersAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Indexers'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="MethodsAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Methods'" />
    <xsl:with-param name="column1" select="'Signature'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template match="ValuesAdded">

  <xsl:call-template name="write_section">
    <xsl:with-param name="title" select="'Added Enum Values'" />
    <xsl:with-param name="column1" select="'Value'" />
    <xsl:with-param name="column2" select="'Message'" />
  </xsl:call-template>

</xsl:template>

<xsl:template name="write_section" >
  <xsl:param name="title" />
  <xsl:param name="column1" />
  <xsl:param name="column2" />

  <section>
    <title><xsl:value-of select="$title" /></title>
    <content>
      <table>
        <tableHeader>
          <row>
            <entry><para><xsl:value-of select="$column1" /></para></entry>
            <entry><para><xsl:value-of select="$column2" /></para></entry>
          </row>
        </tableHeader>
        <xsl:apply-templates />
      </table>
    </content>
  </section>

</xsl:template>

<xsl:template match="UnaryTypeChange">
  <xsl:comment>Unary Type Change</xsl:comment>
  <row>
    <entry><para><code><xsl:value-of select="Code" /></code></para></entry>
    <entry><para><xsl:value-of select="Message" /></para></entry>
  </row>  
</xsl:template>

<xsl:template match="BinaryTypeChange">
  <xsl:comment>Binary Type Change</xsl:comment>
	<row>
    <entry><para><code><xsl:value-of select="Was" /></code></para></entry><entry><para><code><xsl:value-of select="IsNow" /></code></para></entry><entry><para><xsl:apply-templates select="Message" /></para></entry></row>
</xsl:template>

</xsl:stylesheet>
